<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title><s:text name="content.list.title"/></title>
	<%@ include file="/common/meta.jsp"%>
	<%@ include file="/common/common.jsp"%>
</head>
<body>
<div class="popwrapper">
<div class="lighttit"><p><span><input type="button" value="&nbsp;" id="lightclose" class="lightclose" /><strong><s:text name="topic.title"/></strong></span></p></div>
<div class="lightmain">
	<div class="popmain fr">
		<frame src="" name="popframe" scrolling="auto" noresize>
				<div id="wrapper">
				<tr>
				<th><s:text name="category.catIndexTpl"/>:</th>
				<td>
					<s:textfield name="category.catIndexTpl" id="selectIndex" required="true" requiredposition="right" cssClass="txtin" readonly="true"/>
					<a href="#"  onclick="selectIndex()"><s:text name="choice"/></a>
				</td>
				<th><s:text name="category.catContentListTpl"/>:</th>
				<td>
					<s:textfield name="category.catContentListTpl" id="catContentListTpl" required="true" requiredposition="right" cssClass="txtin" readonly="true"/>
					<a href="#"  onclick="contentListTpl()"><s:text name="choice"/></a>
				</td>
			</tr>
			<tr>
				<th><s:text name="category.catDefaultContentTpl"/>:</th>
				<td>
					<s:textfield name="category.catDefaultContentTpl" id="catDefaultContentTpl" required="true" requiredposition="right" cssClass="txtin" readonly="true"/>
					<a href="#"  onclick="defaultContentTpl()"><s:text name="choice"/></a>
				</td>
				<th><s:text name="category.catContentTplSet"/>:</th>
				<td>
					<s:textfield name="category.catContentTplSet" id="catContentTplSet" required="true" requiredposition="right" cssClass="txtin" readonly="true"/>
					<a href="#"  onclick="contentTplSet()"><s:text name="choice"/></a>
				</td>
			</tr>
				</div>	
			</frame>
	</div>
	
	<div class="popmenu fl">
		<div class="leftmenu fl">
			<dl>
				<dt>专题内容管理</dt>
				<dd class="current"><a href="#" onclick="addContent()" target="popframe">新增文章</a></dd>
				<%-- <dd><a href="${ctx}/content/content-list.action?tflag=1&content.topic.topicId=4028839d303136090130313a2e050001&content.topic.keywords=gg" >文章列表</a></dd> --%>
				<dd><a href="#" onclick="contenList()">文章列表</a></dd>
				<dd><a href="#" onclick="checkContent()">审核文章</a></dd>
				<dd><a href="#" onclick="tplSelect()">专题模板</a></dd>
				<dd><a href="#" onclick="keyWords()">关键字</a></dd>
				<dd><a href="#">预览</a></dd>
			</dl>
		</div>
	</div>
	<div class="clear">&nbsp;</div>
</div>
</div>



</body>
</html>
<script type="text/javascript" defer="defer">




//栏目首页模板
function selectIndex(){
	var url = "${ctx}/theme/file-select.action?type=cat&prefix=index&suffix=tpl&elementId=selectIndex"; 
	window.open(url); 
}
//栏目文章列表模板
function contentListTpl(){
	var url = "${ctx}/theme/file-select.action?type=cat&prefix=list&suffix=tpl&elementId=catContentListTpl"; 
	window.open(url); 
}
//栏目的默认文章模板
function defaultContentTpl(){
	var url = "${ctx}/theme/file-select.action?contentType=article&prefix=list&suffix=tpl&elementId=catDefaultContentTpl"; 
	window.open(url); 
}
//栏目的可选文章模板
function contentTplSet(){
	var url = "${ctx}/theme/file-select.action?contentType=article&prefix=list&suffix=tpl&elementId=catContentTplSet"; 
	window.open(url); 
}











	var topicId = $("#tId").val();
	//alert("id--"+topicId);
	
	//移动至下拉菜单显示/隐藏
	$(function(){
		$("#listydz").hover(function(){
			$("#listydzlayer").show();
		},function(){
			$("#listydzlayer").hide();
		});
		$("#listydzlayer").hover(function(){
			$("#listydzlayer").show();
		},function(){
			$("#listydzlayer").hide();
		});
	});
	//移动至下拉菜单显示/隐藏
	$(function(){
		$("#listydz2").hover(function(){
			$("#listydzlayer2").show();
		},function(){
			$("#listydzlayer2").hide();
		});
		$("#listydzlayer2").hover(function(){
			$("#listydzlayer2").show();
		},function(){
			$("#listydzlayer2").hide();
		});
	});
	//移动至下拉菜单显示/隐藏
	$(function(){
		$("#top_new_btn").hover(function(){
			$("#addType").show();
		},function(){
			$("#addType").hide();
		});
		$("#addType").hover(function(){
			$("#addType").show();
		},function(){
			$("#addType").hide();
		});
	});
	
	actionName = "content";	
	confirmStr = "<s:text name="delete.confirm"/>";
	chiocenothing = "<s:text name="chiocenothing"/>";
	$(function(){
		$("#top_new_btn").click(goNormalContentNew);
 		$("#normal_content").click(goNormalContentNew);
 		$("#picture_content").click(goPictureContentNew);
 		$("#video_content").click(goVideoContentNew);
 		$("#flash_content").click(goFlashContentNew);
 		$("#link_content").click(goLinkContentNew);
 		$("#software_content").click(goSoftwareContentNew);
 		$("#top_anti_btn").click(antiSelect);
 		$("#top_del_btn").click(goBatchDel);
 		$("#bottom_del_btn").click(goBatchDel);
 		$("#bottom_anti_btn").click(antiSelect);
		$("#search_btn").click(searchByKeywords);
		$("#all_check").click(selAll);
		$("#extend").click(extend);
		$("#save_btn").click(saveKeywords);
		$("#bottom_ignore_btn").click(ignore);
		$("#bottom_noIgnore_btn").click(noIgnore);
		$("#top_ignore_btn").click(ignore);
		$("#top_noIgnore_btn").click(noIgnore);
	});
	

	var g = function(D) {
		if ( D.indexOf(" ") == -1){
			return ( D.substring(0,1) === "#") ? document.getElementById(D.substring(1,D.length)) : document.getElementsByTagName(D);
		}
		else {
			var ary = D.split(" ");
			return g(ary[0]).getElementsByTagName(ary[1]);
		}
	};
	function inputvalue(){
		var d = g("#listbox input"), i = 0, j = d.length, str = "";
	    for ( ; i < j ; i ++ ) {
				str += (d[i].type == "checkbox" && d[i].id != "totalCheck" && d[i].checked == true ) ? d[i].value + "@" : "";
		};	
		return (str.slice(0,-1));
	};
	
	function addContent(){
		goNormalContentNew();
	}
	
	//保存关键字
	function saveKeywords(){
		var keywd = $("#keywd").val();
		var obj = {"topic.topicId":topicId,"topic.keywords":keywd};
		if(keywd != null && keywd != ""){
			$.get("${ctx}/topic/topic-savekeywords.action",obj,function(data){
				if(data == "yes"){
					alert("关键字保存成功");
				}
			});
		}else{
			alert("关键字不能为空");
		}
	}
	//根据关键字查询
	function searchByKeywords(){
		var keywd = $("#keywd").val();
		document.location.href="content-listnotin.action?tflag=1&topic.topicId="+topicId+"&content.keywords="+keywd;
	}
	//忽略文章
	function ignore(){
		var ids = inputvalue();
		if(!ids){
			alert("您未选择任何一个");
			return;		
		}
		$.get("${ctx}/topic/topiccontent-save.action?topicContent.topic.topicId="+topicId+"&ids="+ids,function(data){
			if(data == "yes"){
				alert("忽略成功");
			}else{
				alert("您选择了已经忽略的文章");
			}
		});
	}
	//取消忽略
	function noIgnore(){
		var ids = inputvalue();
		if(!ids){
			alert("您未选择任何一个");
			return;		
		}
		$.get("${ctx}/topic/topiccontent-delete.action?topicContent.topic.topicId="+topicId+"&ids="+ids,function(data){
			if(data == "yes"){
				alert("取消忽略成功");
			}else{
				alert("该文章已经取消忽略");
			}
		});
	}
	//选择专题模板
	function tplSelect(){
		
	}
	//文章列表
	function contenList(){
		document.location.href="content-list.action?tflag=1&topic.topicId="+topicId;
	}
	//审核文章列表
	function checkContent(){
		document.location.href="content-list.action?tflag=1&topic.topicId="+topicId+"&content.contentStatus=2";
	}
	//关键字文章列表
	function keyWords(){
		document.location.href="content-listnotin.action?tflag=1&topic.topicId="+topicId;
	}
	function goPublish(id,flag){
		document.location.href="content-publish.action?orig=input&contextType=0&content.category.categoryId=<s:property value="content.category.categoryId"/>&content.contentId="+id+"&cflag="+flag;
	}
	
	function goNormalContentNew(){
		document.location.href="content-input.action?orig=input&contextType=0&content.category.categoryId=<s:property value="content.category.categoryId"/>&content.topic.topicId="+topicId+"&tflag="+1;
	}
	function goPictureContentNew(){
		document.location.href="picturecontent-input.action?orig=input&contextType=0&pictureContent.category.categoryId=<s:property value="content.category.categoryId"/>&content.topic.topicId="+topicId+"&tflag="+1;
	}
	function goVideoContentNew(){
		document.location.href="videocontent-input.action?orig=input&contextType=0&videoContent.category.categoryId=<s:property value="content.category.categoryId"/>&content.topic.topicId="+topicId+"&tflag="+1;
	}
	function goFlashContentNew(){
		document.location.href="flashcontent-input.action?orig=input&contextType=0&flashContent.category.categoryId=<s:property value="content.category.categoryId"/>&content.topic.topicId="+topicId+"&tflag="+1;
	}
	function goLinkContentNew(){
		document.location.href="linkcontent-input.action?orig=input&contextType=0&linkContent.category.categoryId=<s:property value="content.category.categoryId"/>&content.topic.topicId="+topicId+"&tflag="+1;
	}
	function goSoftwareContentNew(){
		document.location.href="softwarecontent-input.action?orig=input&contextType=0&softwareContent.category.categoryId=<s:property value="content.category.categoryId"/>&content.topic.topicId="+topicId+"&tflag="+1;
	}
	function goAudit(id,flag){
		document.location.href="content-input.action?orig=input&contextType=0&content.category.categoryId=<s:property value="content.category.categoryId"/>&content.contentId="+id+"&cflag="+flag;
	}
	function unlock(id){
		document.location.href="content-unlock.action?orig=input&contextType=0&content.category.categoryId=<s:property value="content.category.categoryId"/>&content.contentId="+id;
	}
	function goSoftEdit(param,id){
		document.location.href="softwarecontent-input.action?"+param+"="+id+"&orig=edit";
	}
	function goVideoEdit(param,id){
		document.location.href="videocontent-input.action?"+param+"="+id+"&orig=edit";
	}
	function goPicEdit(param,id){
		document.location.href="picturecontent-input.action?"+param+"="+id+"&orig=edit";
	}
	function goFlashEdit(param,id){
		document.location.href="flashcontent-input.action?"+param+"="+id+"&orig=edit";
	}
	function goLinkEdit(param,id){
		document.location.href="linkcontent-input.action?"+param+"="+id+"&orig=edit";
	}
	function goDelPicContent(id){
		document.location.href="content-delete.action?key="+id+"&content.topic.topicId="+topicId+"&tflag=1";
	}
	function goEditPicContent(param,id){
		document.location.href="content-input.action?"+param+"="+id+"&orig=edit&content.topic.topicId="+topicId+"&tflag=1";
	}
	</script>